package com.sxm.yiwei.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.sxm.yiwei.R;
import com.sxm.yiwei.activitis.HotSendSelectTypeActivity;

import java.util.List;

/**
 * Created by KuKa on 2017/9/8.
 */

public class IntroAdapter extends BaseAdapter {
    Context context;
    List<String> data;
    public IntroAdapter(Context context, List<String> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        View view;
        if (convertView==null){
            view = View.inflate(context, R.layout.intro_item,null);
            holder = new ViewHolder();
            holder.intro = (TextView) view.findViewById(R.id.intro_tt);
            view.setTag(holder);
        }else {
            view = convertView;
            holder = (ViewHolder) view.getTag();
        }
        holder.intro.setText(data.get(position));
        return view;

    }
    class ViewHolder{
        TextView intro;
    }
}
